package com.example.controller.util;


import com.example.domain.PhoneDto;

public class UserHolder {
    private static final ThreadLocal<PhoneDto> tl = new ThreadLocal<>();

    /**
     * 往线程池里存user
     * @param
     */
    public static void saveUser(PhoneDto phoneDto){
        tl.set(phoneDto);
    }

    /**
     * 从threadLocal中取出user对象
     *
     * @return
     */
    public static PhoneDto getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
